home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / e / amigae33a.lha / E_v3.3a / Src.lha / Src / Gfx / TextureMapping / geom.e < prev    next >
Text File  |  1980-05-10  |  964b  |  38 lines

  1. -> 3d geometry stuff
  2.  
  3. OPT MODULE
  4.  
  5. EXPORT OBJECT point
  6.   x,y,z
  7. ENDOBJECT
  8.  
  9. EXPORT OBJECT opoint OF point        -> point with orientation e.g. a camera
  10.   turn,up,tilt
  11. ENDOBJECT
  12.  
  13. PROC sin(x,f) IS !Fsin(x!/1800.0*3.14159)*(f!)!        -> replace by tables!
  14. PROC cos(x,f) IS !Fcos(x!/1800.0*3.14159)*(f!)!
  15. PROC atan(x,unit) IS !Fatan(x!/(unit!))/3.14159*1800.0!
  16. PROC atanf(x,u) IS IF u>0 THEN atan(x,u) ELSE (IF u=0 THEN (IF x>0 THEN 900 ELSE -900) ELSE 1800-atan(x,-u))
  17.  
  18. EXPORT PROC project3d(camera:PTR TO opoint,p:PTR TO point,midx,midy,persp)
  19.   DEF x,y,z,t,old,sx,sy
  20.   x:=p.x-camera.x
  21.   y:=p.y-camera.y
  22.   z:=camera.z-p.z
  23.   IF t:=camera.turn*10
  24.     x:=cos(t,old:=x)-sin(t,y)
  25.     y:=sin(t,old)+cos(t,y)
  26.   ENDIF
  27.   IF t:=camera.up*10
  28.     z:=cos(t,old:=z)-sin(t,y)
  29.     y:=sin(t,old)+cos(t,y)
  30.   ENDIF
  31.   IF t:=camera.tilt*10
  32.     x:=cos(t,old:=x)-sin(t,z)
  33.     z:=sin(t,old)+cos(t,z)
  34.   ENDIF
  35.   sx:=atanf(x,y)*(midx*2)/persp/10+midx
  36.   sy:=atanf(z,y)*(midy*2)/persp/10+midy
  37. ENDPROC sx,sy
  38.